﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>无标题页</title>
    <script type="text/javascript">
    function initEvent()
    {
        var as = document.getElementsByTagName("a");
        for(var i=0;i<as.length;i++)
        {
            var a = as[i];
            a.onclick = hrefOnclick;
        }
    }
    
    function hrefOnclick()
    {
        var as = document.getElementsByTagName("a");  //为什么在360中没有用....
        for(var i=0;i<as.length;i++)
        {
            var a = as[i];
            if(a == this)
            {
                a.style.background = "Red";
            }
            else{
                a.style.background = "White";
            }
        }
        window.event.returnValue=false;
    }
    </script>
</head>
<body onload="initEvent()" >
<a href="http://www.baidu.com">百度</a>
<a href="http://www.baidu.com">百度</a>
<a href="http://www.baidu.com">百度</a>
<a href="http://www.baidu.com">百度</a>
</body>
</html>
